package com.ruoyi.common.cyzUtils;

import java.util.Calendar;
import java.util.Date;

public class DateComplate {
    public static boolean dateComplateToNow(Date d){
        Calendar dateOne=Calendar.getInstance();
        Calendar dateTwo=Calendar.getInstance();
        dateOne.setTime(new Date());    //设置为当前系统时间
        dateTwo.setTime(d);
        long timeOne=dateOne.getTimeInMillis();
        long timeTwo=dateTwo.getTimeInMillis();
        long second=(timeTwo-timeOne)/(1000);//转化second
        if(second<=0){
            System.out.println(second);
            return true;
        }else{
            System.out.println(second);
            return false;
        }
    }

    public static void main(String[] args) {
        Date date1 = new Date();
        Date date2 = new Date(date1.getTime()+1000);
        System.out.println(DateComplate.dateComplateToNow(date2));
    }
}
